package com.zzyl.common.thread;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
public class UserTheadLocal {
    private final static ThreadLocal<Long> USER_CONTEXT =new ThreadLocal<>();


    public static void setUser(Long userId){
        USER_CONTEXT.set(userId);
    }
    public static Long getUser(){
        return USER_CONTEXT.get();
    }
    public static void clean(){
        USER_CONTEXT.remove();
    }
}
